﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class cn_showproduct : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string productId = Request["pid"];
        if (productId == null)
        {
            Response.Redirect("products.aspx");
        }
        try
        {
            int pid = Convert.ToInt32(productId);
            DB db = new DB();
            Product product = db.getProduct(pid);
            nameLabel.Text = product.Name_cn;
            dateLabel.Text = "上传于: " + product.Date.ToString().Substring(0, product.Date.ToString().IndexOf(" "));
            imageLabel.ImageUrl = "~/pimages/"+product.Image;

        }
        catch (Exception)
        {
            Response.Redirect("products.aspx");
        }
    }
}
